package com.gxy.learn.backup.shiroauth.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxy.learn.backup.shiroauth.entity.SysUser;
import com.gxy.learn.backup.shiroauth.mapper.SysUserMapper;
import com.gxy.learn.backup.shiroauth.service.SysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * author: Gao xueyong
 * Create at: 2022/1/4 下午11:53
 */
@Slf4j
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
    @Override
    public SysUser getByLoginName(String loginName) {
        if (StringUtils.isBlank(loginName)) {
            return null;
        }
        LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysUser::getLoginName, loginName);
        return getOne(queryWrapper);
    }
}
